package com.bc.bczbweb.controller.Ajax;

import com.bc.bcapi.service.T_Common_reportService;
import com.bc.bcapi.service.T_Common_report_subService;
import com.bc.bcmodel.domain.T_Common_reportModel;
import com.bc.bcmodel.domain.T_Common_report_subModel;
import com.bc.bcmodel.resp.AdminReportListResp;
import com.bc.commonentity.common.JsonResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Name AjaxT_Common_reportController
 * @Description TODO
 * @Author douhaichao
 * @Date 2019/5/15 8:54
 * @Version 1.0
 **/
@RestController
@RequestMapping("ajax/t_common_report")
public class AjaxT_Common_reportController {
    @Autowired
    T_Common_reportService t_Common_reportService;
    @Autowired
    T_Common_report_subService t_common_report_subService;

    @RequestMapping(value = "add", method = RequestMethod.POST)
    public JsonResult add(AdminReportListResp req) {
        JsonResult js = new JsonResult();
        if (req.getId() == null || req.getId().intValue() <= 0) {
            return js;
        }
        T_Common_reportModel t_common_reportModel = new T_Common_reportModel();
        t_common_reportModel.setId(req.getRid());
        t_common_reportModel.setAudit_status(req.getIco_audit_status());
        t_Common_reportService.update(t_common_reportModel);

        T_Common_report_subModel t_common_report_subModel = new T_Common_report_subModel();
        t_common_report_subModel.setId(req.getId());
        t_common_report_subModel.setAudit_status(req.getAudit_status());
        t_common_report_subService.update(t_common_report_subModel);

        return js;
    }

}
